﻿@model GiftCardModel

@inject Nop.Services.Common.IGenericAttributeService genericAttributeService
@inject IWorkContext workContext
@{
    const string hideInfoBlockAttributeName = "GiftCardPage.HideInfoBlock";
    var hideInfoBlock = genericAttributeService.GetAttribute<bool>(workContext.CurrentCustomer, hideInfoBlockAttributeName);

    const string hideUsageHistoryBlockAttributeName = "GiftCardPage.HideUsageHistoryBlock";
    var HideUsageHistoryBlock = genericAttributeService.GetAttribute<bool>(workContext.CurrentCustomer, hideUsageHistoryBlockAttributeName, defaultValue: true);
}

<div asp-validation-summary="All"></div>
<input asp-for="Id" type="hidden" />

<div class="content">
    <div class="form-horizontal">
        <nop-panels id="gift-card-panels">
            <nop-panel asp-name="gift-card-info" asp-icon="fa fa-info" asp-title="@T("Admin.GiftCards.Info")" asp-hide-block-attribute-name="@hideInfoBlockAttributeName" asp-hide="@hideInfoBlock" asp-advanced="false">@await Html.PartialAsync("_CreateOrUpdate.Info", Model)</nop-panel>
            
            @if (Model.Id > 0)
            {
                <nop-panel asp-name="gift-card-usage-history" asp-icon="fa fa-history" asp-title="@T("Admin.GiftCards.History")" asp-hide-block-attribute-name="@hideUsageHistoryBlockAttributeName" asp-hide="@HideUsageHistoryBlock" asp-advanced="false">@await Html.PartialAsync("_CreateOrUpdate.History", Model)</nop-panel>
            }
        
            @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.GiftCardDetailsBlock, additionalData = Model })
        </nop-panels>
    </div>
</div>